<%
# Copyright (C) 2016 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%= render partial: 'sis_agent_token_auth', locals: { f: f } %>

<% if Assignment.sis_grade_export_enabled?(@account) %>
    <fieldset id="sis_grade_export_settings">
        <legend>{{#t}}SIS Grade Export Settings{{/t}}</legend>
        <table class="formtable">
        <%= f.fields_for :settings do |settings| %>
            <%= settings.fields_for :sis_default_grade_export do |r| %>

                <%
                hash = @account.sis_default_grade_export
                disabled = hash[:locked] && hash[:inherited]
                %>

                <tr>
                    <td colspan="2">
                        <%= r.check_box :value, :checked => hash[:value], :disabled => disabled %>
                        <%= r.label :value, t("\"Sync Grades to SIS\" checkbox is enabled by default for assignments, graded discussions, and quizzes") %>
                    </td>
                </tr>
                <% unless disabled %>
                <tr>
                    <td colspan="2" class="sub_checkbox">
                        <%= r.check_box :locked, :checked => hash[:locked] %>
                        <%= r.label :locked, t("Lock this setting for sub-accounts") %>
                    </td>
                </tr>
                <% end %>
            <% end %>
        <% end %>
        </table>
    </fieldset>
<% end %>
